<template>
	<view class="mainpadding2">
		<view class="mainpadding_top ffffff radius" v-for="item in list.data" :key="item.id" @click="jumpurl('/pages_mine/shangchengddxq?id=',item.id)">
			<view class="flexbetween pdl">
				<view class="titletext">{{item.order_no}}</view>
				<view class="xiaolan">已完成</view>
			</view>
			<view class="margin_top pdl flexleft" v-for="ite in item.ordergoods" :key="ite.id">
				<image :src="ite.goods_image_text" class="listleftimg radius" mode=""></image>
				<view class="flexcolumnbet margin_left2" style="height: 140rpx;width: 100%;">
					<view class="hei_text bold main_size yihang">{{ite.goods_name}}</view>
					<view class="xiaohui">{{ite.sku}}</view>
					<view class="flexbetween" style="width: 100%;">
						<view class="hong_text main_size bold">￥{{ite.pay_price}}</view>
						<view class="xiaohui">*{{ite.goods_num}}</view>
					</view>
				</view>
			</view>
			<view class="margin_top flexright">
				<text class="xiaohui">共计{{item.total_num}}件商品，合计<text class="xiaohong bold">￥{{item.pay_price}}</text></text>
			</view>
			<view class="flexright margin_top">
				<view class="listbtnlan2 margin_left2">查看详情</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			init(isPage, page) {
				let _this = this;
				httpRequest.request('/api/goods_order/orderlist', 'GET', {
					page: page || 1,
					state:6
				}, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			jumpurl(url,id){
				uni.navigateTo({
					url:url+id
				})
			},
		}
	}
</script>

<style>

</style>
